package com.onpositive.knowledge.model.value.audits;

import java.io.Serializable;
import java.util.LinkedHashSet;

import com.onpositive.knowledge.model.IHasUniverse;
import com.onpositive.knowledge.model.IUniverse;
import com.onpositive.semantic.model.api.property.IProperty;

public abstract class AbstractAuditResult implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -127068211088062260L;
	protected LinkedHashSet<Object> suspicious = new LinkedHashSet<Object>();
	protected boolean looksApplyable;

	protected String propertyId;
	private String comment ;
	private String auditId ;
	
	public void setUniverse( IUniverse universe )
	{
		for( Object o : suspicious )
		{
			if( o instanceof IHasUniverse )
			{
				IHasUniverse hu = (IHasUniverse) o ;
				((IHasUniverse) o).setUniverse(universe) ;
			}
		}
	}
	
	public AbstractAuditResult(){} ;
	public AbstractAuditResult( IProperty prop ){
		
		if( prop != null )
			this.propertyId = prop.getId() ;		
	}
	
	public AbstractAuditResult( IUniverseAudit audit ){
		
		if( audit != null )
			this.auditId = audit.getId() ;		
	}
	

	public void addAsSuspicious(Object o) {
		suspicious.add(o);
	}
	
	public boolean isLooksApplyable() {
		return looksApplyable;		
	}

	public String getPropertyId() {
		return propertyId;
	}


	public Object[] getSuspicious() {
		return suspicious.toArray();
	}

	public boolean isSuspicios(Object obj) {
		return suspicious.contains(obj);
	}
	
	public void setLooksApplyable(boolean looksApplyable) {
		this.looksApplyable = looksApplyable;
	}


	public String getComment() {
		return comment;
	}


	public void setComment(String comment) {
		this.comment = comment;
	}


	public String getAuditId() {
		return auditId;
	}


	public void setAuditId(String auditId) {
		this.auditId = auditId;
	}

}